<?php
/**
 * Auction
 * 
 * @author Eric
 * @version 
 */
require_once 'Zend/Db/Table/Abstract.php';
class Application_Model_Topup extends Zend_Db_Table_Abstract {
	
	/**
	 * The default table name 
	 */
	protected $_name = 'top_up';
	
	// 父表
	protected $_referenceMap = array(
    	'user' => array(
			'columns' => array('user_id'),
           	'refTableClass' => 'Application_Model_User',
           	'refColumns' => array('id'),
           	'onUpdate' => self::CASCADE, //更新主表记录时是否更新关联记录
    	)
	);
	
	public function getTopupById($id) {
		$row = $this->fetchRow ( 'id = ' . $id );
		return $row;
	}
	
	public function getTopupByTradeNo($trade_num) {
		$row = $this->fetchRow ( 'trade_num = ' . $trade_num );
		return $row;
	}
}
